#include "assignment.h"
#include "ui_assignment.h"
#include<QPainter>
#include<QFont>
#include<QPushButton>
#include<QTimer>
#include"mainwindow.h"
Assignment::Assignment(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Assignment)
{
    ui->setupUi(this);
    this->setGeometry(435,100,700,700);
    backButton=new QPushButton("返回游戏",this);
    backButton->move(0,0);
    backButton->resize(100,50);
    setFixedSize(700,700);
    setWindowTitle("任务界面");
    connect(backButton,&QPushButton::clicked,this,&Assignment::gobackgame);
}

Assignment::~Assignment()
{
    delete ui;
}
void Assignment::paintEvent(QPaintEvent*event)
{
    QPainter painter(this);
    QFont font1("Courier",20);
    painter.setFont(font1);
    painter.setPen(Qt::black);
    painter.setBrush(Qt::black);
    painter.drawText(250,180,mainwindow1->nowassignment[0]);
    painter.drawText(250,280,mainwindow1->nowassignment[1]);
    painter.drawText(250,380,mainwindow1->nowassignment[2]);
    painter.drawText(140,180,"任务一:");
    painter.drawText(140,280,"任务二:");
    painter.drawText(140,380,"任务三:");
}
void Assignment::gobackgame()//回去
{
    this->close();
    mainwindow1->timer->start(50);//重新启动计时器
    mainwindow1->timer1->start(1000);
    mainwindow1->show();
}







